package com.sfc.spiderweb.rest;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sfc.spiderweb.entity.param.AmazonViolationDataParam;
import com.sfc.spiderweb.entity.po.AmazonViolationData;
import com.sfc.spiderweb.entity.vo.AmazonViolationDataVo;
import com.sfc.spiderweb.entity.vo.Result;
import com.sfc.spiderweb.service.AmazonViolationDataService;
import com.sfc.spiderweb.util.BeanUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Api(tags = "amazon账号违规数据 ->Earl")
@RestController
@RequestMapping(value = "/amazonViolationData")
@Slf4j
public class AmazonViolationDataController {

    @Autowired
    private AmazonViolationDataService service;

    @ApiOperation(value = "amazon账号违规数据信息查询 ->Earl", notes = "amazon账号违规数据信息查询")
    @PostMapping("/getPage")
    public Result<Page<AmazonViolationDataVo>> amazonTransfer(@Valid @RequestBody AmazonViolationDataParam param) {
        Page<AmazonViolationData> page = service.getPage(param);
        Page<AmazonViolationDataVo> amazonViolationDataVoPage = BeanUtil.copyPageInfo(page, AmazonViolationDataVo.class);
        System.out.println(amazonViolationDataVoPage);
        return Result.success(BeanUtil.copyPageInfo(page, AmazonViolationDataVo.class));
    }
}
